package com.rh.mybatisstudy.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rh.mybatisstudy.dao.UserMapper;
import com.rh.mybatisstudy.model.Article;
import com.rh.mybatisstudy.model.Person;
import com.rh.mybatisstudy.service.IUserService;

@Service("userService")
public class UserServiceImpl implements IUserService {

	@Autowired
	private UserMapper userMapper;

	public Person getUserById(int id) {
		return userMapper.selectUserByID(id);
	}

	public Person findUserByLoginName(String username) {
		System.out.println("findUserByLoginName call!");
		return userMapper.findUserByLoginName(username);
	}

	public List<Article> getUserArticlesByID(int id) {
		List<Article> articles = userMapper.getUserArticles(1);
		return articles;
	}

}
